import QtQuick 2.0

Item {
    id: notes
    width: 1670
    height: 820

    property int notesID: 0
    property int todoID: 0

    Row {
        anchors.top: parent.top
        anchors.right: parent.right
        anchors.topMargin: 10
        anchors.rightMargin: 10
        spacing: 20

        Rectangle {
            width: 100
            height: 30
            color: sidemenu.unselectColor

            border.width: 1
            border.color: content.border.color

            Text {
                anchors.fill: parent
                text: "TODO"
                font.family: "Verdana"
                font.pointSize: 20
                font.bold: true
                verticalAlignment: Text.AlignVCenter
                horizontalAlignment: Text.AlignHCenter
                color: "white"
            }

            MouseArea {
                anchors.fill: parent

                onClicked: {
                    startSpeechRecognitionReq("todo", 3000);
                }
            }
        }

        Rectangle {
            width: 100
            height: 30
            color: sidemenu.unselectColor

            border.width: 1
            border.color: content.border.color

            Text {
                anchors.fill: parent
                text: "Note"
                font.family: "Verdana"
                font.pointSize: 20
                font.bold: true
                verticalAlignment: Text.AlignVCenter
                horizontalAlignment: Text.AlignHCenter
                color: "white"
            }

            MouseArea {
                anchors.fill: parent

                onClicked: {
                    startSpeechRecognitionReq("notes", 5000);
                }
            }
        }
    }

    function addNote(noteText, isTodo) {
        if( isTodo ) {
            var component = Qt.createComponent("TODO.qml");
            var todo = component.createObject(notes, {"title": "TODO", "note": noteText});
            todo.addItem(noteText);

        } else {
            var component = Qt.createComponent("Note.qml");
            var note = component.createObject(notes, {"title": "Note", "note": noteText});
        }
    }
}
